-
Notifications
You must be signed in to change notification settings - Fork 8
dev #690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jbcaillau
wants to merge
2
commits into
main
Choose a base branch
from
develop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+587
−1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
jbcaillau
commented
Jan 15, 2026
- CTParser v0.8 integration tests
- check src/exa_linalg.jl (type piracy)
Contributor
Member
Author
|
@ocots 🙂 julia> using OptimalControl
julia> using OptimalControl.ExaLinAlg
julia> using MadNLPMumps
julia> t0 = 0
0
julia> tf = 1
1
julia> x0 = [-1, 0]
x2-element Vector{Int64}:
-1
0
julia> xf = [0, 0]
2-element Vector{Int64}:
0
0
julia> A = [0 1; 0 0]
2×2 Matrix{Int64}:
0 1
0 0
julia> b = [0, 1]
2-element Vector{Int64}:
0
1
julia> o = @def begin
t ∈ [t0, tf], time
x ∈ R², state
u ∈ R, control
x(t0) == x0
x(tf) == xf
ẋ(t) == A * x(t) + u(t) * b
0.5∫( u(t)^2 ) → min
end
solAbstract definition:
t ∈ [t0, tf], time
x ∈ R², state
u ∈ R, control
x(t0) == x0
x(tf) == xf
ẋ(t) == A * x(t) + u(t) * b
0.5 * ∫(u(t) ^ 2) → min
The (autonomous) optimal control problem is of the form:
minimize J(x, u) = ∫ f⁰(x(t), u(t)) dt, over [0, 1]
subject to
ẋ(t) = f(x(t), u(t)), t in [0, 1] a.e.,
ϕ₋ ≤ ϕ(x(0), x(1)) ≤ ϕ₊,
where x(t) ∈ R² and u(t) ∈ R.
julia> solve(o, :exa, :madnlp)
▫ This is OptimalControl version v1.1.6 running with: direct, exa, madnlp.
▫ The optimal control problem is solved with CTDirect version v0.17.4.
┌─ The NLP is modelled with ExaModels and solved with MadNLP suite.
│
├─ Number of time steps⋅: 250
└─ Discretisation scheme: midpoint
▫ This is MadNLP version v0.8.12, running with mumps
Number of nonzeros in constraint Jacobian............: 1754
Number of nonzeros in Lagrangian Hessian.............: 1000
Total number of variables............................: 753
variables with only lower bounds: 0
variables with lower and upper bounds: 0
variables with only upper bounds: 0
Total number of equality constraints.................: 504
Total number of inequality constraints...............: 0
inequality constraints with only lower bounds: 0
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 0
iter objective inf_pr inf_du inf_compl lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
0 5.0000000e-03 1.10e+00 3.96e-16 0.00e+00 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0
1 6.0000967e+00 3.20e-16 6.08e-04 0.00e+00 -1.0 6.08e+00 -4.0 1.00e+00 1.00e+00h 1
2 6.0000960e+00 3.36e-12 1.27e-07 0.00e+00 -5.7 3.81e-03 -4.5 1.00e+00 1.00e+00h 1
3 6.0000960e+00 2.13e-16 3.55e-10 0.00e+00 -8.6 3.20e-05 -5.0 1.00e+00 1.00e+00h 1
Number of Iterations....: 3
(scaled) (unscaled)
Objective...............: 6.0000960015360283e+00 6.0000960015360283e+00
Dual infeasibility......: 3.5549475516094553e-10 3.5549475516094553e-10
Constraint violation....: 2.1337098754514727e-16 2.1337098754514727e-16
Complementarity.........: 0.0000000000000000e+00 0.0000000000000000e+00
Overall NLP error.......: 3.5549475516094553e-10 3.5549475516094553e-10
Number of objective function evaluations = 4
Number of objective gradient evaluations = 4
Number of constraint evaluations = 4
Number of constraint Jacobian evaluations = 4
Number of Lagrangian Hessian evaluations = 3
Total wall-clock secs in solver (w/o fun. eval./lin. alg.) = 24.643
Total wall-clock secs in linear solver = 0.026
Total wall-clock secs in NLP function evaluations = 0.000
Total wall-clock secs = 24.670
EXIT: Optimal Solution Found (tol = 1.0e-08).
• Solver:
✓ Successful : true
│ Status : SOLVE_SUCCEEDED
│ Message : MadNLP
│ Iterations : 3
│ Objective : 6.000096001536028
└─ Constraints violation : 2.1337098754514727e-16
• Boundary duals: [0.0, 0.0, 0.0, 0.0] |
Member
Author
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.